//
//  DetailTableViewCell.m
//  CapriceMusic
//
//  Created by 蒋恩浩 on 16/1/7.
//  Copyright © 2016年 MYX. All rights reserved.
//

#import "DetailTableViewCell.h"

@interface DetailTableViewCell ()

@property (nonatomic, strong) UIImageView *artistAvatarImgView;
@property (nonatomic, strong) JEHLabel *artistNameLabel;

@end

@implementation DetailTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.backgroundColor = [UIColor clearColor];
        self.artistAvatarImgView = [[UIImageView alloc] initWithFrame:CGRectZero];
        self.artistAvatarImgView.contentMode = UIViewContentModeScaleAspectFit;
        self.artistAvatarImgView.clipsToBounds = YES;
        self.artistAvatarImgView.layer.cornerRadius = 30;
        
        self.artistNameLabel = [[JEHLabel alloc] initWithFrame:CGRectZero withFont:12 withTextColor:[UIColor colorWithRed:30 / 255.0 green:195 / 255.0 blue:153 / 255.0 alpha:1.0]];
        self.artistNameLabel.text = @"艺人:";
        self.artistNameLabel.numberOfLines = 0;
        [self addSubview:self.artistAvatarImgView];
        [self addSubview:self.artistNameLabel];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.artistAvatarImgView.frame = CGRectMake(20, 10, 60, 60);
    self.artistNameLabel.frame = CGRectMake(90, 10, self.width - 110, 60);
    if (self.artistNameLabel.text.length > 0) {
        
        [self.artistNameLabel attributedText:@"艺人:" withFont:12 withColor:[UIColor whiteColor]];
    }
}

- (void)setDetailDescriptionModel:(DetailDescriptionModel *)detailDescriptionModel {
    
    if (_detailDescriptionModel != detailDescriptionModel) {
        
        _detailDescriptionModel = detailDescriptionModel;
    }
    self.artistNameLabel.text = [NSString stringWithFormat:@"艺人:\n\n%@", detailDescriptionModel.artistName];
    [self.artistAvatarImgView sd_setImageWithURL:[NSURL URLWithString:detailDescriptionModel.artistAvatar]];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
